/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package treccontextsug;

/**
 *
 * @author Marcelo
 */
public class Result implements Comparable<Result> {

    public double ranking;
    public String docId;
    public String url;
    public String title;
    public String description;

    public Result() {
        ranking = 0.0;
        docId = "";
        url = "";
        title = "";
        description = "";
    }

    public Result(double ranking, String docId, String url, String title, String description) {
        this.ranking = ranking;
        this.docId = docId;
        this.url = url;
        this.title = title;
        this.description = description;        
    }

    @Override
    public boolean equals(Object e) {        
        if (e instanceof Result) {
            Result res = (Result)e;
            return this.docId.equals(res.docId);
        } else {
            return false;
        }
    }

    @Override
    public int compareTo(Result other) {
        if (ranking < other.ranking) {
            return -1;
        } else if (ranking == other.ranking) {
            return 0;
        } else {
            return 1;
        }
    }
}
